import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/ruoyi";
// 修改用户 三方店铺地址
export function updatOtherShopAddress(data) {
  return request({
    url: '/account/tenant/update/otherShopAddress',
    method: 'post',
    data: data,
    timeout: 2000000
  })
}
// 查询用户列表
export function listUser(query) {
  return request({
    url: '/system/user/list',
    method: 'get',
    params: query
  })
}

// 查询用户详细  不带实名信息
export function getUser(userId) {
  return request({
    url: '/system/user/' + praseStrEmpty(userId),
    method: 'get'
  })
}
// 查询用户详细 带实名信息
export function getUserSm(userId) {
  return request({
    url: '/system/user/sm/' + praseStrEmpty(userId),
    method: 'get'
  })
}

// 新增用户
export function addUser(data) {
  return request({
    url: '/system/user',
    method: 'post',
    data: data,
    timeout: 2000000
  })
}

// 修改用户
export function updateUser(data) {
  return request({
    url: '/system/user',
    method: 'put',
    data: data,
    timeout: 2000000
  })
}

// 删除用户
export function delUser(userId) {
  return request({
    url: '/system/user/' + userId,
    method: 'delete'
  })
}

// 导出用户
export function exportUser(query) {
  return request({
    url: '/system/user/export',
    method: 'get',
    params: query
  })
}

// 用户密码重置
export function resetUserPwd(userId, password) {
  const data = {
    userId,
    password
  }
  return request({
    url: '/system/user/resetPwd',
    method: 'put',
    data: data
  })
}

// 用户状态修改
export function changeUserStatus(userId, status) {
  const data = {
    userId,
    status
  }
  return request({
    url: '/system/user/changeStatus',
    method: 'put',
    data: data
  })
}

// 查询用户个人信息 走后台缓存
export function getUserProfile() {
  return request({
    url: '/system/user/profile',
    method: 'get'
  })
}
// 查询用户个人信息  不走后台缓存
export function getUserProfileByUserId() {
  return request({
    url: `/system/user/profile/new`,
    method: 'get'
  })
}

// 修改用户个人信息
export function updateUserProfile(data) {
  return request({
    url: '/system/user/profile',
    method: 'put',
    data: data
  })
}

// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
  const data = {
    oldPassword,
    newPassword
  }
  return request({
    url: '/system/user/profile/updatePwd',
    method: 'put',
    params: data
  })
}

// 用户头像上传
export function uploadAvatar(data) {
  return request({
    url: '/upload/image',
    method: 'post',
    data: data
  })
}

// 下载用户导入模板
export function importTemplate() {
  return request({
    url: '/system/user/importTemplate',
    method: 'get'
  })
}
//供货商列表
export function supplyList() {
  return request({
    url: '/system/user/getUserByRoleCode',
    method: 'get'
  })
}

// 查询授权角色
export function getAuthRole(userId) {
  return request({
    url: '/system/user/authRole/' + userId,
    method: 'get'
  })
}
export function offAccount(userId) {
  return request({
    url: '/system/user/off/account/' + userId,
    method: 'get'
  })
}

// 保存授权角色
export function updateAuthRole(data) {
  return request({
    url: '/system/user/authRole',
    method: 'put',
    params: data
  })
}
//涨价

export function addprice(data) {
  return request({
    url: '/system/user/user/addprice',
    method: 'post',
    data: data
  })
}
// 查询供货商appid等信息
export function getForUserId(data) {
  return request({
    url: '/supply/info/getForUserId',
    method: 'get',
    params: data
  })
}
// 编辑自动获取次数
export function upCampNumber(data) {
  return request({
    url: '/system/user/upCampNumber',
    method: 'post',
    data
  })
}

// 设置回收商的回收游戏
export function setHuishouGame(data) {
  return request({
    url: '/account/game',
    method: 'post',
    data
  })
}

// 查询回收商的回收游戏
export function getHuishouGame(data) {
  return request({
    url: '/account/game',
    method: 'get',
    params: data
  })
}

// 查询所有供货商及游戏数量
export function userGameCount(data) {
  return request({
    url: '/indexData/count/userGameCount',
    method: 'get',
    params: data
  })
}
// 查询所有供货商及游戏数量
export function countForSupply(data) {
  return request({
    url: 'goods/info/countForSupply',
    method: 'get',
    params: data
  })
}
// 根据游戏及筛选信息查询供货人
export function accountUserGameCount(data) {
  return request({
    url: '/account/push/userGameCount',
    method: 'get',
    params: data
  })
}

// 根据条件查询供货商及游戏数量
export function countForSupplyFilter(data) {
  return request({
    url: "/account/rprice/userGameCount",
    method: "get",
    params:data
  });
}

// 用户实名认证
export function realnameauth(data) {
  return request({
    url: "/realname/auth",
    method: "post",
    data
  });
}

// 根据用户userId获取用户环信id
export function getHXUserInfoByUserId(params) {
  return request({
    url: "/system/user/getHXUserInfo",
    method: "get",
    params
  });
}
// 法大大认证企业 /account/tenant/qiyerenzheng
export function dianpurenzheng(data) {
  return request({
    url: "/account/tenant/dianpurenzheng",
    method: "post",
    data,
    timeout:30*1000
  });
}
// 撤销店铺认证
export function quxiaorenzheng(data) {
  return request({
    url: "/account/tenant/quxiaorenzheng",
    method: "post",
    data,
    timeout:30*1000
  });
}

// 强制用户下线
export function qiangzhixiaxian(data) {
  return request({
    url: "/system/user/forceOut",
    method: "post",
    data
  });
}